class Solution:
    def numOfSubarrays(self, arr: list) -> int:
        MOD = 10**9 + 7
        odd = 0
        even = 0
        s = 0
        ans = 0
        for num in arr:
            s += num
            if s % 2 != 0:
                ans = (ans + even + 1) % MOD
                odd += 1
            else:
                ans = (ans + odd) % MOD
                even += 1
        return ans
